/**    
 * 文件名：Record.java</br>
 *    
 * 版本信息：v1.0</br>
 * 日期：2017年10月13日</br>
 * © 2005-2017 雷技信息科技（上海）有限公司版权所有</br>
 *
 */
package com.logic.landseaserver.domain;

import java.sql.Timestamp;
import java.util.Date;

import com.logic.common.security.SecurityUtils;

/**
 *
 * 项目名称：system-server</br>
 * 类名称：Record</br>
 * 类描述：XXXXRecord的父类</br>
 * 创建人：Aaron</br>
 * 创建时间：2017年10月13日 下午2:45:09</br>
 * @version 1.0
 *
 */
public class Record
{
    private Integer createdBy;

    private Date createdDtm;

    private Integer version;

    private Date lastModifiedDtm;

    private Integer lastModifiedBy;

    private Boolean deleted;


    public Integer getCreatedBy()
    {
        return createdBy;
    }

    public void setCreatedBy(Integer createdBy)
    {
        this.createdBy = createdBy;
    }

    public Date getCreatedDtm()
    {
        return createdDtm;
    }

    public void setCreatedDtm(Date createdDtm)
    {
        this.createdDtm = createdDtm;
    }

    public Integer getVersion()
    {
        return version;
    }

    public void setVersion(Integer version)
    {
        this.version = version;
    }

    public Date getLastModifiedDtm()
    {
        return lastModifiedDtm;
    }

    public void setLastModifiedDtm(Date lastModifiedDtm)
    {
        this.lastModifiedDtm = lastModifiedDtm;
    }

    public Integer getLastModifiedBy()
    {
        return lastModifiedBy;
    }

    public void setLastModifiedBy(Integer lastModifiedBy)
    {
        this.lastModifiedBy = lastModifiedBy;
    }

    public Boolean getDeleted()
    {
        return deleted;
    }

    public void setDeleted(Boolean deleted)
    {
        this.deleted = deleted;
    }
    
    public void initCommonField()
    {
        this.createdDtm = new Timestamp(new Date().getTime());
        Integer userId = SecurityUtils.getCurrentLogin().getUserId();
        this.lastModifiedDtm = this.createdDtm;
        this.createdBy = userId;
        this.lastModifiedBy = userId;
        this.deleted = Boolean.valueOf(false);
        this.version = Integer.valueOf(0);
    }
    
    public void editInitCommonField()
    {
        Integer userId = SecurityUtils.getCurrentLogin().getUserId();
        this.lastModifiedDtm = new Timestamp(new Date().getTime());
        this.lastModifiedBy = userId;
        this.deleted = Boolean.valueOf(false);
        this.version = Integer.valueOf(0);
    }

    public void initCommonFieldWithUser(Integer userId)
    {
        this.createdDtm = new Timestamp(new Date().getTime());
        this.lastModifiedDtm = this.createdDtm;
        this.createdBy = userId;
        this.lastModifiedBy = userId;
        this.deleted = Boolean.valueOf(false);
        this.version = Integer.valueOf(0);
    }
    
    /**    
     * [描述]：</br>
     *
     * @return
     *
    */
    @Override
    public String toString()
    {
        return "Record [createdBy=" + createdBy + ", createdDtm=" + createdDtm + ", version=" + version
            + ", lastModifiedDtm=" + lastModifiedDtm + ", lastModifiedBy=" + lastModifiedBy + ", deleted=" + deleted
            + "]";
    }
}
